<template>
    <a-timeline>
        <view v-for="(item, index) in detailList">
            <a-timeline-item color="green">
                <a-collapse v-model:activeKey="activeKey" :bordered="false">
                    <a-collapse-panel :key="item.id" :header="`${item.wellId}  信息 ${item.createdTime}`">
                        <!-- <AntdZh>
                            <a-popconfirm title="是否删除该测井记录" @confirm="handleDelete(item.id)">
                                <a-button danger>删除</a-button>
                            </a-popconfirm>
                        </AntdZh> -->
                        <WellData :value="item.id" />
                    </a-collapse-panel>
                </a-collapse>
            </a-timeline-item>
        </view>
    </a-timeline>
</template>
<script setup>
import request from '@/utils/request'
// 测井数据
import WellData from './WellData'
import { queryList, getDataOne } from '@/api/design/schemes.js'
// import { queryList, queryOne } from '@/custom/well/api/well';
import { ref, watch } from 'vue'
import useApp from "@/hooks";
const { $, proxy } = useApp();
const activeKey = ref(null)
const formRef = ref(null)
const props = defineProps({
    data: {
        type: Object
    }
})
const detailList = ref([])
const query = ref({ pageNum: 1, pageSize: 100, sortBy: 'id', searchKey: '', wellId: undefined });

// 监听
watch(() => props.data, (newVal, oldVal) => {
    getList()
})
const form = ref({
    file: null,
    remark: ''
})

// 删除
// function handleDelete(id) {
//     deleteOne(id).then(res => {
//         $.showToast({
//             title: '删除成功',
//             icon: 'success'
//         })
//         getList()
//     })
// }

function getList() {
    let wellData = JSON.parse(localStorage.getItem('wellData'))
    console.log('wellData', wellData);
    query.value.wellId = wellData.wellId
    queryList(query.value).then(res => {
        console.log('detailWell', res.content);
        detailList.value = res.content

        if (detailList.value.length == 0) {
            $.showToast({
                title: '未记录信息',
                icon: 'loading'
            })
        }
    })

}
getList()
</script>